/*
 * Copyright 2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.dopdf.document.model;

import org.dopdf.utils.Constants;

/**
 * The class that holds the information about the page that is to be rendered.  Information like which document does
 * this page belong to, what is the page number etc is held in this class.
 *
 * @author Deep Shah
 */
public class PageDetail {

    /** The document id. */
    private String documentId;

    /** The page number. */
    private int pageNumber;

    /** The pdf fetching strategy to be used. */
    private Constants.PDFFetchingStrategy documentFetchingStrategy;

    /** The page size that is to be used. */
    private Constants.PageSize size;

    /**
     * The constructor that takes in the document id, fetching strategy, page number, and size as arguments.  The string
     * value of fetching strategy and size will be converted into enums.
     * @param documentId the document id.
     * @param documentFetchingStrategy the fetching strategy.
     * @param pageNumber the page number.
     * @param size the size of the page to return.
     */
    public PageDetail(final String documentId, final String documentFetchingStrategy,
                      final int pageNumber, final String size) {

        this.documentId = documentId;
        this.documentFetchingStrategy = Constants.PDFFetchingStrategy.parse(documentFetchingStrategy);
        this.pageNumber = pageNumber;
        this.size = Constants.PageSize.parse(size);
    }

    /**
     * The getter for the document id.
     * @return the value held.
     */
    public String getDocumentId() {
        return documentId;
    }

    /**
     * The getter for the page number.
     * @return the value held.
     */
    public int getPageNumber() {
        return pageNumber;
    }

    /**
     * The getter for the fetching strategy.
     * @return the value held.
     */
    public Constants.PDFFetchingStrategy getDocumentFetchingStrategy() {
        return documentFetchingStrategy;
    }

    /**
     * The getter for the size.
     * @return the value held.
     */
    public Constants.PageSize getSize() {
        return size;
    }
}
